/**
 * 
 */
package com.joinfun.rdsdk.mingdao.utils;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author FMK
 * 2014年1月5日下午12:46:01
 *
 */
public class JsonConverter {
	private static ObjectMapper mapper;

	

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static Object convertToAuth(String str, Class clazz) throws JsonParseException, JsonMappingException, IOException {
		return getMapper().readValue(str, clazz);
	}
	
	public static ObjectMapper getMapper() {
		if(mapper == null) {
			mapper = new ObjectMapper();
		}
		return mapper;
	}
}
